import * as THREE from "three";


export default function () {
    const r = 1737.10; //千米
    const far_with_earth = 384403.9
    // const selfSpeed = 0.001227; //实际速度除以1000

    let moon: THREE.Mesh;

  function drawMoon(scene: THREE.Scene) {
    const loader = new THREE.TextureLoader();
    loader.load("./8k_moon.jpg", (texture) => {
      const geometry = new THREE.SphereGeometry(r, 128, 128);
      const material = new THREE.MeshBasicMaterial({
        map: texture,
      });
      moon = new THREE.Mesh(geometry, material);
      moon.translateX(far_with_earth);
      scene.add(moon);
    },()=>{

    },(err)=>{
        console.log("error",err);
    });
  }

  function moonRender(){
    if(moon!=null) {
    }
  }

  return { drawMoon,moonRender };
}